refactor(ram): batch ValEvaluation and ValFinal into RamValCheck#1203
Merged
moodlezoup merged 11 commits intoa16z:mainfrom Feb 17, 2026
Merged
refactor(ram): batch ValEvaluation and ValFinal into RamValCheck#1203moodlezoup merged 11 commits intoa16z:mainfrom
moodlezoup merged 11 commits intoa16z:mainfrom
Conversation
Contributor
Author
|
Pushed follow-up commit removing the legacy separate RAM val sumchecks now that Stage 4 uses . Commit: 4b237af. |
Contributor
Author
|
Follow-up: removed the legacy separate RAM Commit: 4b237af |
Stage 4 verifier referenced `ram::gen_ram_initial_memory_state` without importing the module. Use the fully qualified `crate::zkvm::ram::...` path so the workspace builds in CI.
Align Stage 2 RAM sumchecks with RW address-binding rounds via internal dummy rounds, and simplify downstream value/RA reductions by unifying on a single aligned r_address. Co-authored-by: Cursor <cursoragent@cursor.com>
OutputCheck no longer needs to cache RamValInit now that Stage 4 is consolidated under RamValCheck. Avoid emitting an unused virtual opening (which trips release test assertions that all cached virtual openings are consumed). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
OutputCheck only checks IO consistency via Val_final - Val_io, so it does not need to bind or cache Val_init. After consolidating Stage 4 into RamValCheck, Val_init is derived from public initial RAM (plus advice) rather than being plumbed through OutputCheck openings. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR’s main contribution is a Stage 4 RAM value refactor: it replaces two separate RAM value sumchecks on
main(ValEvaluationandValFinal) with a single batched sumcheck instance:RamValCheck.To make that batching clean (and to enable further simplifications), Stage 2 is also refactored so
RamRafEvaluationandRamOutputCheckconsume transcript challenges in the exact same global rounds thatRamReadWriteCheckingbinds RAM address variables, independent ofReadWriteConfig.Stage 4:
RamValCheckbatchesValEvaluation+ValFinalWhat changes vs
main:mainhad two Stage 4 sumchecks (ValEvaluation,ValFinal), each with its own cached openings.jolt-core/src/zkvm/ram/val_check.rs.Batched identity (one shared
r_address)At the aligned RAM address point
r_addressand RW’s cycle pointr_cycle, we check:Val(r_address, r_cycle) - Val_init(r_address) = Σ_j inc(j) · wa(r_address, j) · LT(j, r_cycle)Val_final(r_address) - Val_init(r_address) = Σ_j inc(j) · wa(r_address, j)and batch them with a transcript challenge
γ(domain sep labelram_val_check_gamma):(1) + γ·(2) = Σ_j inc(j) · wa(r_address, j) · ( LT(j, r_cycle) + γ )Where does
Val_init(r_address)come from now?RamOutputCheckidentity.RamValCheckderives it from public initial RAM (plus advice contributions on the verifier path), rather than plumbing it as anOutputCheck-cached virtual opening.Openings / IDs
SumcheckId::RamValEvaluationandSumcheckId::RamValFinalEvaluationare removed; Stage 4 uses onlySumcheckId::RamValCheck.RamValCheckcaches:VirtualPolynomial::RamRaat(r_address || r_cycle′)underSumcheckId::RamValCheckCommittedPolynomial::RamIncatr_cycle′underSumcheckId::RamValCheckThis eliminates the need to maintain two separate “val” opening IDs/points downstream.
Stage 2: align address rounds (enables the Stage 4 simplification)
To ensure a single shared
r_addressacross RAM protocols (regardless ofReadWriteConfig):RamRafEvaluation(jolt-core/src/zkvm/ram/raf_evaluation.rs)num_rounds()to match RW’s address-binding schedule and uses internal dummy rounds (constant univariates + ignore challenges) during RW Phase 3’s cycle region.input_claim()by2^{(#dummy rounds)}so the batched transcript remains consistent.normalize_opening_point()extracts only the address challenges (skipping dummy rounds), so its cachedr_addressmatches RW’s.RamOutputCheck(jolt-core/src/zkvm/ram/output_check.rs)r_addressmatches RW’s.VirtualPolynomial::RamValFinal); it does not cache or bindVal_init.Stage 5: RA claim reduction becomes cycle-only (log_T rounds)
With
r_addressalready aligned and fixed,RamRaClaimReductionno longer needs to reduce over address variables:jolt-core/src/zkvm/claim_reductions/ram_ra.rs:num_rounds() == log_T.(r_address || r_cycle_reduced)underSumcheckId::RamRaClaimReductionsoram/ra_virtual.rscan keep splitting atlog_K.Advice claim reduction: single opening only
jolt-core/src/zkvm/claim_reductions/advice.rsnow always uses a single advice opening derived fromSumcheckId::RamValCheck.Files changed (high signal)
jolt-core/src/zkvm/ram/val_check.rs(new Stage 4 batched sumcheck)jolt-core/src/zkvm/ram/raf_evaluation.rs(alignment + dummy rounds + input-claim renormalization)jolt-core/src/zkvm/ram/output_check.rs(alignment + dummy rounds; drop unusedVal_initplumbing)jolt-core/src/zkvm/claim_reductions/ram_ra.rs(cycle-only reduction)jolt-core/src/zkvm/claim_reductions/advice.rs(single opening only)jolt-core/src/poly/opening_proof.rs(SumcheckId cleanup:RamValCheck)jolt-core/src/zkvm/{prover,verifier}.rs(wiring + transcript labelram_val_check_gamma)Testing
cargo test -p jolt-core --lib --no-runReview guidance
jolt-core/src/zkvm/ram/val_check.rsdocstring +cache_openingslogic (this is the core Stage 4 batching).raf_evaluation.rs/output_check.rs(num_rounds,round_offset, dummy rounds, andnormalize_opening_point).SumcheckId::RamValCheck(advice + increments + RA reduction).